package com.xixilala.video.views

import android.content.Context
import android.opengl.GLSurfaceView
import android.util.AttributeSet
import com.xixilala.video.render.TriangleSimple1Render
import com.xixilala.video.render.TriangleSimpleRender

class TriangleGLSurfaceView:GLSurfaceView {

    constructor(context: Context?) : this(context, null)
    constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)

    private lateinit var mRenderer: Renderer
    init {

        setEGLContextClientVersion(2)

//        mRenderer = TriangleSimpleRender()
        mRenderer = TriangleSimple1Render()

        //该设置可防止系统在您调用 requestRender() 之前重新绘制 GLSurfaceView 帧，这对于此示例应用而言更为高效
//        renderMode = RENDERMODE_WHEN_DIRTY

        setRenderer(mRenderer)
    }
}